use num_traits::Num;
use crate::autograd::function::ForwardArgs::{TensorOther, TensorTensor};
use crate::autograd::function::Function;
use crate::autograd::mse_loss_backward::MseLossBackward;
use crate::autograd::relu_backward::ReluBackward;
use crate::Tensor;

pub fn mse_loss<T>(y_hat: &Tensor<T>, y_i: &Tensor<T>) -> Tensor<T>
    where
        T: Copy + Num + 'static,
{
    MseLossBackward::<T>::apply(TensorTensor(y_hat, y_i))
}

pub fn relu<T>(input: &Tensor<T>) -> Tensor<T>
    where
        T: Copy + Num + PartialOrd + 'static,
{
    ReluBackward::<T>::apply(TensorOther(input, &[]))
}
